# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=py3-maxminddb
pkgver=2.4.0
pkgrel=0
pkgdesc="Python MaxMind DB reader extension"
url="https://maxminddb.readthedocs.io/en/latest/"
arch="all"
license="Apache-2.0"
depends="python3"
makedepends="libmaxminddb-dev python3-dev py3-setuptools"
checkdepends="py3-nose py3-mock"
_test_data_commit=86095bd9855d6313c501fe0097891a3c6734ae90
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/maxmind/MaxMind-DB-Reader-python/archive/v$pkgver.tar.gz
	MaxMind-DB-test-data-$_test_data_commit.tar.gz::https://github.com/maxmind/MaxMind-DB/archive/$_test_data_commit.tar.gz
	"

builddir="$srcdir/MaxMind-DB-Reader-python-$pkgver"

prepare() {
	cd "$srcdir"

	# Submodule required for tests
	cp -r "MaxMind-DB-$_test_data_commit/"* "$builddir/tests/data"

	default_prepare
}

build() {
	python3	setup.py build
}

check() {
	python3	setup.py test
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
7176b861df489e78cfb48acd943070c3aa4f54a072c4ff446f8b1197b9156d82064d198753273e7c4dc24a05855eac5bad345e59d5bb78c31c42c7c40cebafc7  py3-maxminddb-2.4.0.tar.gz
537423532e4d61aa5d207199498a9354d0ea8322af3b66521b6e3fb1fdfbddd82bfeb19781fead84a028c01713c7784f059e6b279799a7cf5aa42502a31ff7c4  MaxMind-DB-test-data-86095bd9855d6313c501fe0097891a3c6734ae90.tar.gz
"
